package volleyball.model;

import java.util.HashSet;

/**
 * Stores Statistics for a player. A Statistic holds a float for everyu time 
 * that Statistic takes place. Each float contains the time that Statistic 
 * took place. Every time must be unique since the same action cannot happen 
 * twice at the same time.
 * @author Joshua Kulhavy-Sutherland
 *
 */
public class Statistic {
	private HashSet<Float> times;
	
	/**
	 * Creates a new Statistic with no times stored in it.
	 */
	public Statistic(){
		times = new HashSet<Float>();
	}
	
	/**
	 * Creates a new Statistic with time already stored in it.
	 * @param time time to add to the Statistic.
	 */
	public Statistic(float time){
		times.add(time);
	}
	
	/**
	 * @return a String of all the times this Statistic took place.
	 */
	public String toString(){
		return times.toString();
	}
	
	/**
	 * @return the total times this Statistic took place
	 */
	public int getSize(){
		return times.size();
	}
	
	/**
	 * @param time Adds this time to this Statistic
	 */
	public void addStat(float time){
		times.add(time);
	}
}
